function repair(m: string | number) {
  return m < 10 ? '0' + m : m;
}
export function formatting(time: string) {
  var times = new Date(time);
  var y = times.getFullYear();
  var m = times.getMonth() + 1;
  var d = times.getDate();
  var h = times.getHours();
  var mm = times.getMinutes();
  var s = times.getSeconds();
  return (
    y +
    '-' +
    repair(m) +
    '-' +
    repair(d) +
    ' ' +
    repair(h) +
    ':' +
    repair(mm) +
    ':' +
    repair(s)
  );
}



import moment from 'moment';
// moment.locale('zh-cn')
// 时间格式转换

export function time(date: string) {
    return moment(date, 'YYYYMMDD').fromNow();
}

export function YYYY_MM_DD(date: string) {
    return moment(date).format('YYYY-MM-DD HH:MM:SS');
}

export function YYYY_MM(date: string) {
    return moment(date).format('MM-DD ');
}